package com.schoolgard.entitybean;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * StudentType entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "STUDENT_TYPE")
public class StudentType implements java.io.Serializable {

	// Fields

	private Long id;
	private TimeArray timeArray;
	private String name;
	private Boolean enable;
	private Set<Student> students = new HashSet<Student>(0);

	// Constructors

	/** default constructor */
	public StudentType() {
	}

	/** minimal constructor */
	public StudentType(Long id, TimeArray timeArray) {
		this.id = id;
		this.timeArray = timeArray;
	}

	/** full constructor */
	public StudentType(Long id, TimeArray timeArray, String name,
			Boolean enable, Set<Student> students) {
		this.id = id;
		this.timeArray = timeArray;
		this.name = name;
		this.enable = enable;
		this.students = students;
	}

	// Property accessors
	@Id
	@Column(name = "ID", unique = true, nullable = false, precision = 16, scale = 0)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TIME_ARRAY_ARRAYNO", nullable = false)
	public TimeArray getTimeArray() {
		return this.timeArray;
	}

	public void setTimeArray(TimeArray timeArray) {
		this.timeArray = timeArray;
	}

	@Column(name = "NAME", length = 64)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "ENABLE", precision = 1, scale = 0)
	public Boolean getEnable() {
		return this.enable;
	}

	public void setEnable(Boolean enable) {
		this.enable = enable;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "studentType")
	public Set<Student> getStudents() {
		return this.students;
	}

	public void setStudents(Set<Student> students) {
		this.students = students;
	}

}